import React, { Component } from 'react'

export default class MyTable extends Component {
  render() {
    return (
      <div>
        <table>
            <thead>
                <tr>
                    {
                        this.props.columns.map(item=><td>{item.columnName}</td>)
                    }
                </tr>
            </thead>
            <tbody>
                {
                    this.props.dataSource.map(item=><tr key={item.id}>
                        <td>{item.id}</td>
                        <td>{item.title}</td>
                        <td>{item.content}</td>
                        <td>{this.props.callback(item)}</td>
                    </tr>)
                }
            </tbody>
        </table>
      </div>
    )
  }
}
